package com.dayaokeji.rhythmschoolstudent.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.dayaokeji.rhythmschoolstudent.client.common.ActivityStackManager;
import com.dayaokeji.rhythmschoolstudent.client.mine.SystemSettingActivity;
import com.dayaokeji.rhythmschoolstudent.client.mine.account.StudentIdLoginActivity;
import com.dayaokeji.rhythmschoolstudent.databases.dao.UserInfoDao;
import com.dayaokeji.rhythmschoolstudent.event.ExitEvent;
import com.orhanobut.logger.Logger;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by Gorden on 2018/1/2.
 */

public class AppExitUtil {

    public static void exit(Activity context) {
        UserUtils.setUserInfo(null);
        UserUtils.setAccessToken(null);
        UserInfoDao.delUserInfo();
        EventBus.getDefault().post(new ExitEvent());
        Intent intent = new Intent(context, StudentIdLoginActivity.class);
        context.startActivity(intent);
        ActivityStackManager.finish(context);
    }
}
